﻿
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- saved from url=(0014)about:internet -->
<html xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:mssdk="winsdk" xmlns:script="urn:script" xmlns:build="urn:build" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="Description" content="Live User-Mode Targets"/>
<meta name="MSHAttr" content="PreferredSiteName:MSDN"/>
<meta name="MSHAttr" content="PreferredLib:/library/windows/hardware"/>
<title>Live User-Mode Targets</title>

<meta name="MS-HAID" content="Engine_DG_5e74ebf4-af57-41c3-ad2a-bd87417cd8d9.xml"/>


<link rel="STYLESHEET" type="text/css" HREF="../common/backsdk4.css"/>





<style>
html,div { margin: 0; padding: 0;}

body {
	padding: 0px;
	margin: 0px;
	overflow: auto;
	height: 100%;
}

#winchm_template_button{
	float: right;
	width: 93px;
	top: 7px;
	position: relative;
	text-align: right;
	right: 5px;
	height: auto;
}

#winchm_template_top{
	padding: 0px;
	margin: 0px;
	border-bottom: 1px solid #9B9B9B;
	background-color: #B1CEFE;
}

#winchm_template_navigation{
	margin: 0px;
	padding-top: 7px;
	padding-left: 7px;
	padding-bottom: 3px;
	padding-right: 0px;
	font-size: 8.5pt;
	font-family: Arial, Helvetica, sans-serif;
	font-weight: normal;
	color: #585858;
}

#winchm_template_title{
	margin: 0px;
	padding-top: 4px;
	padding-left: 7px;
	padding-bottom: 7px;
	padding-right: 0px;
	font-size: 18px; 
	font-family: Verdana, Geneva, sans-serif;
	color: #363636;
}

#winchm_template_content{
	margin-top: 20px;
	margin-left: 15px;
	margin-bottom: 20px;
	margin-right: 15px;
	width: auto  !important;
	width: 100%;
}

#winchm_template_footer{
	border-width: 1px;
	border-color: #B1CEFE;
	border-top-style: solid;
	margin-top: 15px;
	margin-left: 15px;
	margin-bottom: 20px;
	margin-right: 15px;
	padding-top: 7px;
	padding-left: 0px;
	padding-bottom: 0px;
	padding-right: 0px;
	font-family: arial, helvetica, sans-serif;
	font-size: 8.5pt;
	color: #696969;
	width: auto;
	text-align: left;
}


#winchm_template_container{
	margin: 0px;
	padding: 0px;
	position: static;
	padding-bottom: 3px;
	overflow: auto;
	background-color: #FFFFFF;
}


@media print
{
#winchm_template_container{
	position: static;	
	margin: 0px;
	padding: 5px;
	
	width: auto;
	height: auto;
	overflow: auto;
}
#winchm_template_button{
visibility:hidden;
}
}

#winchm_template_navigation A:link	{text-decoration: none; color:#004080}
#winchm_template_navigation A:visited  {text-decoration: none; color: #004080}
#winchm_template_navigation A:active {text-decoration: none; color: #004080 }
#winchm_template_navigation A:hover {text-decoration: none;color: #0080FF}

A:link	{text-decoration: underline; color:#0033CC}
A:visited  {text-decoration: underline; color: #0033CC}
A:active {text-decoration: underline; color: #0033CC }
A:hover {text-decoration: underline;color: #FF0000;}
</style>
<script type="text/javascript">
function isMobile(){
Agent = window.navigator.userAgent;
if (Agent.indexOf("iPhone")>=1 || Agent.indexOf("iPad")>=1 || Agent.indexOf("iPod")>=1 || Agent.indexOf("Android")>=1){
return true;
}else{
return false;	
}

}
function d_onresize(){
if (window.navigator.userAgent.indexOf("MSIE")>=1){
document.getElementById('winchm_template_container').style.pixelWidth = document.body.offsetWidth - 3;
document.getElementById('winchm_template_container').style.pixelHeight = document.body.offsetHeight - document.getElementById('winchm_template_top').offsetHeight - 4;
}
document.getElementById('winchm_template_container').style.top = document.getElementById('winchm_template_top').offsetHeight + 'px';
}

function d_onbeforeprint(){
document.getElementById('winchm_template_container').style.width = 'auto';
document.getElementById('winchm_template_container').style.height = 'auto';
}

function d_onafterprint(){
d_onresize();
}

if(!isMobile()){

window.onload = d_onresize;
window.onresize = d_onresize;
window.onbeforeprint = d_onbeforeprint;
window.onafterprint = d_onafterprint;

document.write("<style>\n");
document.write("body {overflow: hidden;}\n");
document.write("#winchm_template_container {position: absolute;overflow: auto;top : 0px;right: 0px;bottom: 0px;left: 0px;}\n");
document.write("</style>\n");
}

</script>
</head>
<body><script language="JavaScript" type="text/JavaScript">
function syn(){
if(parent.nav.tree){
 if(parent.nav.tree.loaded){
  parent.nav.tree.selectNode(228);
 }else{
  setTimeout("syn()",500);
}
  }else{
  setTimeout("syn()",500);
  }}
if(parent!=self){
  setTimeout("syn()",100);
}else{
  parent.location.href = "../../index.htm?page=debugger/live_user_mode_targets.htm";
}
originalOnload = window.onload;
if(originalOnload==null){
window.onload = function(){parent.contentLoaded = true;};
}else{
window.onload = function(){originalOnload();parent.contentLoaded = true;};
}
</script> 


<div id="winchm_template_top">
	<div id="winchm_template_button"><A href="connecting_to_targets.htm" title="Previous topic"><img id="winchm_template_prev" alt="Previous topic" src="../template2/btn_prev_n.gif" border="0"></a><A href="live_kernel_mode_targets.htm" title="Next topic"><img id="winchm_template_next" alt="Next topic" src="../template2/btn_next_n.gif" border="0"></a></div>
	<div id="winchm_template_navigation">Help &gt; 
<A href="introduction6.htm">Debugging Tools for Windows (WinDbg, KD, CDB, NTSD)</A> &gt; <A href="debugging_resources.htm">Debugging Resources</A> &gt; <A href="debugger_engine_and_extension_apis.htm">Debugger Engine and Extension APIs</A> &gt; <A href="using_the_debugger_engine_api.htm">Using the Debugger Engine API</A> &gt; <A href="debugger_engine_api_overview.htm">Debugger Engine API Overview</A> &gt; <A href="connecting_to_targets.htm">Connecting to Targets</A> &gt; </div>
	<div id="winchm_template_title">Live User-Mode Targets</div>
</div>
<div id="winchm_template_container">
	<div id="winchm_template_content"><div id="mainSection"><p>The methods for creating and attaching to processes that are listed in this topic can be used for the local computer and for a remote computer running a process server.</p>
<p>A user-mode process can be created using <a href="#Bookmark297"><b>Create Process</b></a> or <a href="#Bookmark356"><b>CreateProcess2</b></a>, which execute a given command to create a process.  The method <a href="#Bookmark293"><b>AttachProcess</b></a> can be used to attach the <a href="#Bookmark192">debugger engine</a> to an existing user-mode process.  <a href="#Bookmark298"><b>CreateProcessAndAttach</b></a> and <a href="#Bookmark358"><b>CreateProcessAndAttach2</b></a> create a new user-mode process and attach to it or another user-mode process on the same computer.  The <a href="#Bookmark251"><b>Request</b></a> operations <a href="#Bookmark256"><b>DEBUG_REQUEST_GET_ADDITIONAL_CREATE_OPTIONS</b></a>, <a href="#Bookmark257"><b>DEBUG_REQUEST_SET_ADDITIONAL_CREATE_OPTIONS</b></a>, and <a href="#Bookmark261"><b>DEBUG_REQUEST_SET_LOCAL_IMPLICIT_COMMAND_LINE</b></a> can be used to set some of the default options for creating processes.</p>
<div class="alert"><b>Note</b>    The engine doesn't completely attach to the process until the <a href="#Bookmark465"><b>WaitForEvent</b></a> method has been called.  Only after the process has generated an event -- for example, the process creation event -- does it become available in the debugger session.  See <a href="#Bookmark194">Debugging Session and Execution Model</a> for more details.</div>
<div> </div>
<p>The method <a href="#Bookmark316"><b>GetRunningProcessSystemIds</b></a> will return the process IDs of all the running processes on the computer.  The process ID of a particular program can be found using <a href="#Bookmark315"><b>GetRunningProcessSystemIdByExecutableName</b></a>.  Given a process ID, a description of the process is returned by <a href="#Bookmark314"><b>GetRunningProcessDescription</b></a>.</p>
<h3><a id="Process_Options"></a><a id="process_options"></a><a id="PROCESS_OPTIONS"></a>Process Options</h3>
<p>The process options determine part of the engine's behavior when attached to a user-mode process, including whether or not the debugger engine will automatically attach to child processes created by the target process and what the engine does with the target processes when it exits.  See <a href="#Bookmark893"><b>DEBUG_PROCESS_XXX</b></a> for a description of the process options.</p>
<p>The process options can be queried using <a href="#Bookmark313"><b>GetProcessOptions</b></a>.  They can be changed using <a href="#Bookmark291"><b>AddProcessOptions</b></a>, <a href="#Bookmark320"><b>RemoveProcessOptions</b></a>, and <a href="#Bookmark327"><b>SetProcessOptions</b></a>.</p>
<h3><a id="Disconnecting_from_Processes"></a><a id="disconnecting_from_processes"></a><a id="DISCONNECTING_FROM_PROCESSES"></a>Disconnecting from Processes</h3>
<p>There are three different ways for the engine to disconnect from a process.</p>
<ol>
<li>
<p><i>Detach</i>.  Resume all the threads in the process so that it will continue running, no longer being debugged.  <a href="#Bookmark335"><b>DetachCurrentProcess</b></a> will detach the engine from the current process and <a href="#Bookmark299"><b>DetachProcesses</b></a> will detach the engine from all processes.  Not all targets support detaching. The <a href="#Bookmark251"><b>Request</b></a> operation <a href="#Bookmark260"><b>DEBUG_REQUEST_TARGET_CAN_DETACH</b></a> can be used to check if the target supports detaching.</p>
</li>
<li>
<p><i>Terminate</i>.  Attempt to kill the process.  <a href="#Bookmark338"><b>TerminateCurrentProcess</b></a> will terminate the current process and <a href="#Bookmark330"><b>TerminateProcesses</b></a> will terminate all processes in the debugger session.</p>
</li>
<li>
<p><i>Abandon</i>.  Remove the process from the list of processes being debugged.  The operating system will still consider the process as being debugged and it will remain suspended until another debugger attaches to it or it is killed.  <a href="#Bookmark333"><b>AbandonCurrentProcess</b></a> will abandon the current process.</p></li></ol></div></div>	
	<div id="winchm_template_footer">Copyright &copy; 2019. All rights 
reserved. (To change the copyright info, just edit it in template.)</div>
</div>

</body>
</html>
